package com.neusoft.tools;

import com.neusoft.nep.entity.User;

/**
 * 用于保持用户状态
 */
public final class UserSession {

    private static UserSession instance;
    private User loggedInUser;
    private UserSession() {
    }
    public static UserSession getInstance() {
        if (instance == null) {
            instance = new UserSession();
        }
        return instance;
    }
    public User getLoggedInUser() {
        return loggedInUser;
    }

    public void setLoggedInUser(User user) {
        this.loggedInUser = user;
    }

    // 登出
    public void cleanUserSession() {
        loggedInUser = null;
    }
}